import { Tools } from 'weaver-mobile';

const { callApi } = Tools;

/** Table接口 */
export const getDatas = '/api/ec/dev/table/datas';
export const getChecks = '/api/ec/dev/table/checks';
export const getCounts = '/api/ec/dev/table/counts';

/** 获取列表接口 */
export const getMailFolder = '/api/email/setting/getMailFolder';
export const getMailLabel = '/api/email/setting/getMailLabel';
export const getMailAccount = '/api/email/setting/getMailAccount';
export const getMailSign = '/api/email/sign/getMailSign';
export const getMailTemplate = '/api/email/setting/getMailTemplate';

/** 获取编辑表单接口 */
export const getEmailAccountCondition = '/api/email/condition/getEmailAccountCondition';
export const getEmailLabelCondition = '/api/email/condition/getEmailLabelCondition';

/** 获取对象数据接口 */
export const getMailAccountBean = '/api/email/setting/getMailAccountBean';
export const getMailLabelBean = '/api/email/setting/getMailLabelBean';
export const getMailTemplateBean = '/api/email/setting/getMailTemplateBean';

/** 增删改接口 */
export const operateUserMailSign = '/api/email/sign/operateUserMailSign';
export const operateUserMailTemplate = '/api/email/setting/operateUserMailTemplate';
export const operateUserMailLabel = '/api/email/setting/operateUserMailLabel';
export const operateUserMailFolder = '/api/email/setting/operateUserMailFolder';

/** 邮箱账户接口 */
export const getMailAccountDefaultInfo = '/api/email/setting/getMailAccountDefaultInfo';
export const getEmailEditAccountCondition = '/api/email/condition/getEmailEditAccountCondition';
export const deleteUserMailAccount = '/api/email/setting/deleteUserMailAccount';
export const makeUserMailAccount = '/api/email/setting/makeUserMailAccount';

/** 其他接口 */
export const getMailSetTabs = '/api/email/setting/getMailSetTabs';
export const getEmailSize = '/api/email/folder/getEmailSize';
export const getMailElcSignPreview = '/api/email/sign/getMailElcSignPreview';
export const getMailSignEntity = '/api/email/sign/getMailSignEntity';

export default {
  callApi: params => callApi({ ...params, params: { ...params.params } }),
  getDatas: params => callApi({ url: getDatas, method: 'POST', params }),
  getChecks: params => callApi({ url: getChecks, method: 'POST', params }),
  getCounts: params => callApi({ url: getCounts, method: 'POST', params }),

  getMailSetTabs: params => callApi({ url: getMailSetTabs, method: 'GET', params }),
  getEmailAccountCondition: params => callApi({ url: getEmailAccountCondition, method: 'GET', params }),
  deleteUserMailAccount: params => callApi({ url: deleteUserMailAccount, method: 'post', params }),
  getMailAccountBean: params => callApi({ url: getMailAccountBean, method: 'GET', params }),
  getEmailLabelCondition: params => callApi({ url: getEmailLabelCondition, method: 'GET', params }),
  getMailLabelBean: params => callApi({ url: getMailLabelBean, method: 'GET', params }),
  getEmailSize: params => callApi({ url: getEmailSize, method: 'GET', params }),
  operateUserMailSign: params => callApi({ url: operateUserMailSign, method: 'POST', params }),
  getMailElcSignPreview: params => callApi({ url: getMailElcSignPreview, method: 'GET', params }),
  getMailSignEntity: params => callApi({ url: getMailSignEntity, method: 'GET', params }),
  operateUserMailTemplate: params => callApi({ url: operateUserMailTemplate, method: 'POST', params}),
  getMailTemplateBean: params => callApi({ url: getMailTemplateBean, method: 'GET', params }),
  getMailAccountDefaultInfo: params => callApi({ url: getMailAccountDefaultInfo, method: 'GET', params }),
  getEmailEditAccountCondition: params => callApi({ url: getEmailEditAccountCondition, method: 'GET', params }),
  makeUserMailAccount: params => callApi({ url: makeUserMailAccount, method: 'POST', params }),
  operateUserMailLabel: params => callApi({ url: operateUserMailLabel, method: 'POST', params }),
  operateUserMailFolder: params => callApi({ url: operateUserMailFolder, method: 'POST', params }),
}

